﻿using System;
using System . Collections . Generic;
using System . Linq;
using System . Text;
using System . Threading . Tasks;
using Windows . UI . Xaml;
using Windows . UI . Xaml . Data;

namespace WenceyWang . RichMan4L . Maps . MapDrawers . UWP2DMapDrawer
{
	class BoolVisibleConverter : IValueConverter
	{
		public object Convert ( object value , Type targetType , object parameter , string language )
		{
			if ( !( value is bool ) )
			{
				throw new ArgumentException ( "value should be bool" , nameof ( value ) );
			}
			if ( ( bool ) value )
			{
				return Visibility . Visible;
			}
			else
			{
				return Visibility . Collapsed;
			}
		}

		public object ConvertBack ( object value , Type targetType , object parameter , string language )
		{
			if ( !( value is Visibility ) )
			{
				throw new ArgumentException ( "value should be bool" , nameof ( value ) );
			}

			return ( Visibility ) value == Visibility . Visible;
		}

	}
}
